//package com.czkt.config;
//
//
//
//import org.springframework.cloud.client.ServiceInstance;
//import org.springframework.cloud.client.loadbalancer.LoadBalanced;
//import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
//import org.springframework.cloud.loadbalancer.core.RandomLoadBalancer;
//import org.springframework.cloud.loadbalancer.core.ReactorLoadBalancer;
//import org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplier;
//import org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.env.Environment;
//import org.springframework.web.client.RestTemplate;
//
//@Configuration
////@LoadBalancerClient
//public class RestTemplateConfig {
//
//    @Bean
//    @LoadBalanced//负载均衡
//    public RestTemplate getRestTemplate(){
//        return  new RestTemplate();
//    }
//
////
////    @Bean
////    ReactorLoadBalancer<ServiceInstance> randomLoadBalancer(Environment environment, LoadBalancerClientFactory factory) {
////        String name = environment.getProperty(LoadBalancerClientFactory.PROPERTY_NAME);
////
////        return new RandomLoadBalancer(factory.getLazyProvider(name, ServiceInstanceListSupplier.class), name);           //随机//return new RoundRobinLoadBalancer(factory.getLazyProvider(name, ServiceInstanceListSupplier.class), name);     // 轮训
////    }
//
//
//}
